package Test.stream流测试;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @Author kirito
 * @Date 2023/12/13 15:26
 * @PackageName:Test.stream流测试
 * @ClassName: Map流
 * @Description:
 * @Version 1.0
 */
public class Map流 {
    public static void main(String[] args) {
        String str = "";
        String[] split = str.split(",");
        System.out.println(str.split(",").length);
        System.out.println(Arrays.toString(split));

        Map<String, Integer> map = new HashMap<>();
        map.put("a", 1);
        map.put("b", 2);
        // 键流
        List<String> s2 = map.keySet().stream().collect(Collectors.toList());
        System.out.println(s2);
        // 值流
        List<Integer> s3 = map.values().stream().collect(Collectors.toList());
        System.out.println(s3);
        // 键值对
        List<Map.Entry<String, Integer>> s4 = map.entrySet().stream().collect(Collectors.toList());
        System.out.println(s4);

//        List<IdentityDTO> identityDTOList = identityDtoS.stream() //  根据身份的创建时间进行排序
//                .sorted(Comparator.comparing(IdentityDTO::getCreatedDate, Comparator.nullsLast(Comparator.naturalOrder())).reversed())
//                .collect(Collectors.toList());

    }
}
